
<div class="head">
    <div>PetrovLand</div>
    
</div>
<div id="middle">
    <div class="search"><?php $this->setTemplate('search');?></div>
        <div id="content"><?php 
            if(null!=$this->message){
            foreach($this->message as $v){
            echo "<div>Author: <a href='#' onclick=\"document.location='?control=user&".$v->getMesAuthor()."'\">".$v->getAutherName()."</a></div>
            <div>".$v->getMesText()."</div>
            <div>".$v->getMesDate()."</div>";
            }
        }?></div>
    <div id="menu">User's menu:
<div>
    <?php if(isset($_SESSION['authUserId'])){
    
    if($_SESSION['authUserId']!=$this->user->getUserId()){
        
        echo "
        <div><a href='#' onclick=\"document.location='/'\">Main page</a></div>
        <div><a href='#' onclick=\"document.location='/?control=user&".$_SESSION['authUserId']."'\">My profile</a></div>
        <div id='send'><a href='#'>Send message</a></div>
        <div id='messageForm'>
                <form action='/?control=send' method='POST'>
                    <div>Please enter your message for this user</div>
        <div><textarea name='text' rows='10' cols='40'></textarea></div>
        <div><input type='hidden' name='author' value=\"".$_SESSION['authUserId']."\"></div>
        <div><input type='hidden' name='adressat' value=\"".$this->user->getUserId()."\"></div>
        <div><input type='hidden' name='autherName' value=\"".$_SESSION['authUserName']."\"></div>
        <div><input type='submit' value='Send'><span class='exit'><input type='button' value='Exit'></span></div>
                </form>
        </div>
        <div><a href='#' onclick=\"document.location='?control=photo&user=".$this->user->getUserId()."'\">Photos</a></div>
        ";
    }else{echo "

    <div id='fup'><a href='#'>Upload photo</a></div>
    <div id='fupload'>
        <form enctype='multipart/form-data' action='/?control=upload' method='POST'>
            <div><input type='file' name='fupload'></div>
            <div><input type='hidden' name='userId' value='".$this->user->getUserId()."'></div>
            
            <div><input type='submit' value='Send'><span class='exitFup'><input type='button' value='Exit'></span></div>
        </form>
    </div>
    <div><a href='#' onclick=\"document.location='/?control=userRedact&".$this->user->getUserId()."'\">Update information</a></div>
    <div><a href='#' onclick=\"document.location='/?control=photo&user=".$this->user->getUserId()."'\">My photos</a></div>";
    }}else {echo "<div><a href='#' onclick=\"document.location='/'\">Main page</a></div>";}
    if($_SESSION['error']!=null){echo "<div>".$_SESSION['error']."</div>"; unset($_SESSION['error']);}
    ?>
</div>
</div>
    
<div class="box">

<div id="mainBlock">
    <?php if($this->user->getUserAva()!=null){$ava = $this->user->getUserAva();}else{$ava = './ava.jpg';}?>
    <div id="ava"><img src="<?=$ava?>"></div>
    <div id="userInfo">Info:
        <div class="info">Name:<?=$this->user->getUserName();?></div>
        <div class="info">Sex:<?php if($this->user->getUserSex()=='m'){echo 'male';}else{echo 'female';}?></div>
        <div class="info">Age:<?=$this->user->getUserAge();?></div>
        
    </div>
    </div>
    </div>

</div>

</div>
<div id="footer">
    
    
</div>

